package com.ysd.lis.service.lab.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.ysd.common.Result;
import com.ysd.lis.entity.lab.LabFinanceSalesSettleDetall;
import com.ysd.lis.mapper.lab.LabFinanceSalesSettleDetallMapper;
import com.ysd.lis.request.lab.SalesSettleDto;
import com.ysd.lis.service.lab.LabFinanceSalesSettleDetallService;
import com.ysd.util.ToolsUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 销售财务结算主表 服务实现类
 * </p>
 *
 * @author WH
 * @since 2024-11-06
 */
@Service
public class LabFinanceSalesSettleDetallServiceImpl extends ServiceImpl<LabFinanceSalesSettleDetallMapper, LabFinanceSalesSettleDetall> implements LabFinanceSalesSettleDetallService {

    @Autowired
    LabFinanceSalesSettleDetallMapper labFinanceSalesSettleDetallMapper;
    @Override
    public Result findFinanceSalesSettleDetailList(SalesSettleDto param) {
        MPJLambdaWrapper<LabFinanceSalesSettleDetall> queryWrapper = new MPJLambdaWrapper<>();
        queryWrapper.selectAll(LabFinanceSalesSettleDetall.class);

        queryWrapper.eq(LabFinanceSalesSettleDetall::getDelFlag, 0);
        if (ToolsUtils.isNotEmpty(param.getSalesSettleNo())) {
            queryWrapper.eq(LabFinanceSalesSettleDetall::getSalesSettleNo, param.getSalesSettleNo());
        }
        if (ToolsUtils.isNotEmpty(param.getSalesSettleId())) {
            queryWrapper.eq(LabFinanceSalesSettleDetall::getSalesSettleId, param.getSalesSettleId());
        }
        List<LabFinanceSalesSettleDetall> settleReqList = labFinanceSalesSettleDetallMapper.selectList(queryWrapper);
        return Result.succ(1, "查询成功!", settleReqList);
    }
}
